package com.ruoyi.user.controller;

import com.ruoyi.user.domain.UserDetail;
import com.ruoyi.user.service.UserDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "用户信息接口for 微服务调用")
@RestController
@RequestMapping("/user/info")
public class UserInfoController {
    @Autowired
    private UserDetailService userDetailService;

    @Operation(summary = "获取用户信息接口", description = "根据用户ID获取用户信息")
    @GetMapping
    public UserDetail getUserDetail(@RequestParam("uid") String uid) {
        return userDetailService.getUserDetail(uid);
    }


    @Operation(summary = "获取用户信息接口", description = "根据用户ID列表获取用户信息")
    @PostMapping(value = "/list/more")
    public List<UserDetail> getUserList(@RequestBody List<String> uidList) {
        return userDetailService.getUserList(uidList);
    }


    @Operation(summary = "获取用户信息接口", description = "根据手机号获取用户信息")
    @GetMapping(value = "/byphone")
    public UserDetail getUserDetailByPhone(@RequestParam("phone") String phone) {
        return userDetailService.getUserDetailByPhone(phone);
    }
}
